//
//  YCLoadingVIew.m
//  LOLBox
//
//  Created by bb on 15-3-29.
//  Copyright (c) 2015年 Honey. All rights reserved.
//

#import "YCLoadingVIew.h"

@implementation YCLoadingVIew

- (id)initWithFrame:(CGRect)frame withTitle:(NSString *)title
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        //CGRect rect = self.frame;
        //rect.size.height = rect.size.height - 64 - 50;
        //self.backgroundColor = [UIColor blackColor];
        self.alpha = 0.8;
        
        UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 65, 100, 20)];
        
        v.layer.cornerRadius = 15;
        v.clipsToBounds = YES;
        v.center = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
        v.backgroundColor = [UIColor blackColor];
        v.alpha = 0.8;
        UIActivityIndicatorView *flower = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        
        flower.frame = CGRectMake(40, 30, 20, 20);
        
        [flower startAnimating];
        
        label.text = title;
        label.font = [UIFont systemFontOfSize:12];
        label.textColor = [UIColor whiteColor];
        label.textAlignment = NSTextAlignmentCenter;
        //label.backgroundColor = [UIColor orangeColor];
        //label.frame = CGRectMake(60, 40, 20, 20);
        
        [v addSubview:flower];
        [v addSubview:label];
        [self addSubview:v];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
